package com.bjc.base.service.impl;

import java.util.Iterator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bjc.base.bean.request.OrderReqVO;
import com.bjc.base.bean.response.OrderVO;
import com.bjc.base.core.BaseServiceImpl;
import com.bjc.base.core.IBaseDao;
import com.bjc.base.dao.IOrderDao;
import com.bjc.base.dao.IOrderDetailDao;
import com.bjc.base.service.IOrderService;
import com.bjc.base.utils.StringUtil;

/**
 * <p>
 * 订单 服务实现类
 * </p>
 *
 * @author 许自辉
 * @since 2018-06-10
 */
@Service
public class OrderImpl extends BaseServiceImpl<OrderReqVO, OrderVO> implements IOrderService {
	
	private IOrderDao dao;
	
	@Autowired
	private IOrderDetailDao orderDetailDao;

	@Autowired
	@Override
	public void setBaseDao(IBaseDao<OrderReqVO, OrderVO> baseDao) {
		this.baseDao = baseDao;
		this.dao = (IOrderDao) baseDao;
	}

	@Override
	public int placeOrder(OrderReqVO reqVO) {
		// 下单，添加订单，及订单详情
		String cartIds = reqVO.getCartIds();
		if(StringUtil.isNullOrEmpty(cartIds)) {
			return 0;
		}
		String[] cartIdStr = cartIds.split(",");
		for (String cartId : cartIdStr) {
			
		}
		return 0;
	}
	
}
